package com.example.layui.demo.mapper;

import com.example.layui.demo.entity.Article;
import com.example.layui.demo.entity.ArticleVo;
import com.example.layui.demo.entity.StuCategaryVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface StuMapper {


    @Select("SELECT c.`choices`,s.`sumstu`  FROM categories AS c , student AS s WHERE s.`cid`=c.`id`")
    List<StuCategaryVo> getResult();


    @Select("select * from t_article")
    List<Article> getArticleList();


    List<Article> getArticlePageList(ArticleVo articleVo);


   // @Select("select count(*) from t_article")
    Integer getArticleCount(ArticleVo vo);


    @Select("select * from t_article where id=#{id}")
    Article getArticle(Integer id);


    @Delete("delete from t_article where id=#{id}")
    int delArticlebyId(Integer id);



    @Update("update t_article set title=#{title},created=#{created},hobby=#{hobby} where id=#{id}")
    int updArticleById(Article  article);

    int delArticlebyIds(Integer[] id);


//
//    List<Article> searchByWhere(Article artical);

}
